package com.kang.c0c.tree.node;

import java.util.Vector;


/**
 * 定义抽象语法树的程序序列块子节点
 * Block		：BLOCK	函数
 * 
 * @field
 * statementList：函数体内的程序序列表
 * 
 * @author kang
 *
 * Feb 6, 2009
 */
public class BlockNode extends Node implements Nodes{
	private Vector<Node> statementList;
	
	public BlockNode(){
		super(BLOCK);
		statementList = new Vector<Node>();
	}
	
	public int insertNode(Node node){
		statementList.add(node);
		return statementList.size();
	}
	
	public void insertAt(Node node,int index){
		statementList.insertElementAt(node, index);
	}
	
	public int size(){
		return statementList.size();
	}
	
	public Node get(int i){
		if(i >= statementList.size())
			return null;
		else
			return statementList.elementAt(i);
	}
	
	public void removeNode(int i){
		if(i >= statementList.size())
			return;
		
		statementList.remove(i);
	}
}
